package com.hksj.Intelligentmanagement.controller;

import com.hksj.Intelligentmanagement.enums.QosEnum;
import com.hksj.Intelligentmanagement.mqtt.client.IMqttClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***************************************************************************
 *
 * @类描述:MQTT测试controller
 * @版本: V1.0
 * @创建人： guozhaolong
 * @创建时间：2021-12-02 9:59
 * @修改记录：
 */
@RestController
@RequestMapping("/mqtt")
@Api(tags = "Matt管理")
public class MqttController {

    @Autowired(required = false)
    private IMqttClient emqxClient;

    /**
     * @author liujianfu
     * @description    测试发布主题
     * @date 2021/8/16 15:04
     * @return RUtils
     */
    @ApiOperation(value = "mqtt消息发布")
    @GetMapping("/publishTopic")
    public Object publishTopic() {
        //emqxClient.publish("chenzhang/111","{\"did\":\"FH1050502342\",\"utime\":\"2019/11/04 13:49:56\",\"content\":[{\"pid\":\"10\",\"addr\":\"test5\",\"addrv\":\"66.660000\"}]}", QosEnum.Qos2,false);
        emqxClient.publish("abc","/chenzhang/111", QosEnum.Qos1,true);

        return null;
    }

}
